<f:view
		xmlns="http://www.w3.org/1999/xhtml"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:a4j="http://richfaces.org/a4j"
		xmlns:rich="http://richfaces.org/rich"
		xmlns:ui="http://java.sun.com/jsf/facelets"
		xmlns:itdep="http://itdep.bsuir.by/jsf" xmlns:c="http://java.sun.com/jstl/core"
		>

	<ui:decorate template="/facelets/template/mainTemplate.xhtml">
		<f:loadBundle basename="bundle.department" var="departmentBundle"/>
		<ui:param name="title" value="Plan details"/>
		<ui:define name="center">
			<ui:decorate template="/facelets/template/centerTemplate.xhtml">

				<ui:define name="content">
					<f:loadBundle basename="bundle.plan" var="plansBundle"/>
					<ui:decorate template="/facelets/template/planPanelTemplate.xhtml">
					</ui:decorate>
					<a4j:form>
						<a4j:commandLink value="#{plansBundle.backToSemesterPlans}" action="toSemesterPlan"/>
					</a4j:form>
					<h:outputText value="#{formOfControlSemesterBean.exceptionMessage}" id="exceptionMess"
								  style="color:red"/>
					<h:panelGrid columns="2" styleClass="centerPanel">
						<h:panelGroup>
							<itdep:entityOutput value="#{controlPlanBean.currentSemesterPlan.contentPlan.subject}"
												format="{i18n.fullName}"
												locale="#{subjectDicBean.translationBean.locale}"/>
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{plansBundle.part}"/>
							<h:outputText value="#{controlPlanBean.currentSemesterPlan.coursePartNumber}"/>
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{plansBundle.course}"/>
							<h:outputText value="#{controlPlanBean.currentSemesterPlan.course}"/>
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{plansBundle.semester}"/>
							<h:outputText value="#{controlPlanBean.currentSemesterPlan.term}"/>
						</h:panelGroup>
					</h:panelGrid>
					<h:panelGrid columns="2" styleClass="topPanel">
						<h:column>
							<h:panelGrid width="300px">
								<a4j:form>
									<h:outputText value="#{plansBundle.lessonTypes}:"/>
									<rich:dataTable id="controlPlanLessonTypes" value="#{controlPlanBean.dataModel}"
													var="record" binding="#{controlPlanBean.tableBinding}" width="120px"
											>
										<rich:column width="70px">
											<f:facet name="header"><h:outputText value="#{plansBundle.lessonType}"/>
											</f:facet>

											<itdep:entityOutput value="#{record.lessonType}" format="{i18n.fullName}"
																locale="#{lessonTypeDicBean.translationBean.locale}"/>

										</rich:column>

										<rich:column width="20px">
											<f:facet name="header"><h:outputText
													value="#{plansBundle.quantity}"/></f:facet>

											<h:outputText value="#{record.hours}"/>
										</rich:column>
										<rich:column width="80px">
											<h:panelGroup style="white-space:nowrap;">
												<a4j:commandLink value="#{commonBundle.edit}"
																 action="#{controlPlanBean.edit}"
																 reRender="lessonTypes" immediate="true"/>
												<rich:spacer width="7"/>
												<a4j:commandLink value="#{commonBundle.delete}"
																 action="#{controlPlanBean.delete}"
																 reRender="#controlTablePanel" immediate="true"/>
											</h:panelGroup>
										</rich:column>
									</rich:dataTable>
								</a4j:form>
								<a4j:form>
									<a4j:commandLink value="#{commonBundle.add}" action="#{controlPlanBean.add}"
													 reRender="lessonTypes"
													 rendered="#{not controlPlanBean.editMode}"/>
								</a4j:form>
								<a4j:form>
									<h:panelGrid columns="2"
												 rendered="#{controlPlanBean.editMode}">
										<h:outputText value="#{plansBundle.lessonType}"/>
										<itdep:entitySelectMenu
												value="#{controlPlanBean.record.lessonType}" id="lessonTypes"
												entityType="lesson-type" format="{i18n.fullName}" required="true"
												filter="#{lessonTypeDicBean.filter}"
												style="width:100px"/>
										<h:outputText value="#{plansBundle.quantity}"/>
										<h:inputText value="#{controlPlanBean.record.hours}" id="hours"
													 style="width:100px"/>
										<a4j:commandLink value="#{commonBundle.save}" action="#{controlPlanBean.save}"
														 reRender="controlTablePanel"/>
										<a4j:commandLink value="#{commonBundle.cancel}"
														 action="#{controlPlanBean.cancel}"
														 immediate="true"
														 reRender="controlTablePanel"/>
									</h:panelGrid>
								</a4j:form>
							</h:panelGrid>
						</h:column>

						<h:column>
							<h:panelGrid width="300px">

								<a4j:form>
									<h:outputText value="#{plansBundle.formOfControl}"/> &#160;
									<rich:dataTable id="semesterPlanFormsOfControl"
													value="#{formOfControlSemesterBean.dataModel}" var="record"
													binding="#{formOfControlSemesterBean.tableBinding}" width="120px">
										<rich:column width="70px">
											<f:facet name="header"><h:outputText value="#{plansBundle.formOfControl}"/>
											</f:facet>
											<itdep:entityOutput value="#{record.formOfControl}" format="{i18n.fullName}"
																locale="#{formOfControlDicBean.translationBean.locale}"/>
										</rich:column>

										<rich:column width="20px">
											<f:facet name="header"><h:outputText value="#{plansBundle.attachment}"/>
											</f:facet>

											<h:selectBooleanCheckbox value="#{record.diplomaIncluded}"
																	 id="diplomaIncluded" disabled="true"/>
										</rich:column>
										<rich:column width="80px">
											<h:panelGroup style="white-space:nowrap;">

												<a4j:commandLink value="#{commonBundle.edit}"
																 action="#{formOfControlSemesterBean.edit}"
																 reRender="controlTablePanel" immediate="true"/>
												<rich:spacer width="7"/>
												<a4j:commandLink value="#{commonBundle.delete}"
																 action="#{formOfControlSemesterBean.delete}"
																 reRender="controlTablePanel,exceptionMess"
																 immediate="true"/>
											</h:panelGroup>
										</rich:column>
									</rich:dataTable>
								</a4j:form>
								<a4j:form>
									<a4j:commandLink value="#{commonBundle.add}"
													 action="#{formOfControlSemesterBean.add}"
													 reRender="controlTablePanel"
													 rendered="#{not formOfControlSemesterBean.editMode}"/>
								</a4j:form>
								<a4j:form>
									<h:panelGrid columns="2"
												 rendered="#{formOfControlSemesterBean.editMode}">
										<h:outputText value="#{plansBundle.formOfControl}"/>
										<itdep:entitySelectMenu
												value="#{formOfControlSemesterBean.record.formOfControl}"
												entityType="form-of-control" format="{i18n.fullName}" required="true"
												filter="#{formOfControlDicBean.filter}"
												style="width:100px"/>
										<h:outputText value="#{plansBundle.attachment}"/>
										<h:selectBooleanCheckbox
												value="#{formOfControlSemesterBean.record.diplomaIncluded}"
												id="diplomaIncluded"/>

										<a4j:commandLink value="#{commonBundle.save}"
														 action="#{formOfControlSemesterBean.save}"
														 reRender="controlTablePanel"/>
										<a4j:commandLink value="#{commonBundle.cancel}"
														 action="#{formOfControlSemesterBean.cancel}"
														 immediate="true"
														 reRender="controlTablePanel"/>
									</h:panelGrid>
								</a4j:form>
							</h:panelGrid>
						</h:column>
					</h:panelGrid>


				</ui:define>


			</ui:decorate>

		</ui:define>
	</ui:decorate>

</f:view>